package cn.afactory.tygz.ui;

import android.os.Bundle;
import android.view.View;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;

import cn.afactory.tygz.R;
import cn.afactory.tygz.common.UserListType;
import cn.afactory.tygz.db.DBManager;
import cn.afactory.tygz.model.UserInfo;
import cn.afactory.tygz.ui.base.BaseActivity;
import cn.afactory.tygz.ui.base.utils.NaviUtils;
import cn.afactory.tygz.ui.base.utils.SPUtils;
import cn.afactory.tygz.ui.base.views.MineMenuItem;

/**
 * Created with Android Studio.
 * Title:MyFriendsActivity
 * Description:
 * Copyright:Copyright (c) 2015
 * Company:和平必胜、正义必胜、人民必胜
 * Author:炎黄子孙
 * Date:15/9/11
 * Time:下午1:53
 * Version 1.0
 */
@ContentView(R.layout.ac_my_friends)
public class MyFriendsActivity extends BaseActivity{
    @ViewInject(R.id.menu_wdfs)
    private MineMenuItem mWdfsItem;
    @ViewInject(R.id.menu_wdox)
    private MineMenuItem mWdoxItem;
    @ViewInject(R.id.menu_wdhy)
    private MineMenuItem mWdhyItem;

    private UserInfo mUserInfo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ViewUtils.inject(this);

        mUserInfo = DBManager.getInstance(getApplicationContext()).getDefaultUserInfo();

        initUI();
        initTitleBar();
    }

    private void initUI(){
        mWdfsItem.initItem(R.drawable.ic_fans,R.string.label_menu_wdfs,-1);
        mWdoxItem.initItem(R.drawable.ic_followed,R.string.label_menu_wdox,-1);
//        mWdhyItem.initItem(R.drawable.ic_default_setting, R.string.label_menu_wghy, -1);

        mWdfsItem.setValue(mUserInfo.fans + "");
        mWdoxItem.setValue(mUserInfo.focus + "");

        mWdfsItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                NaviUtils.gotoUserList(MyFriendsActivity.this,
                        SPUtils.getUid(MyFriendsActivity.this),
                        getString(R.string.title_my_fans),
                        -1,
                        -1,
                        UserListType.MY_FANS);
            }
        });

        mWdoxItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                NaviUtils.gotoUserList(MyFriendsActivity.this,
                        SPUtils.getUid(MyFriendsActivity.this),
                        getString(R.string.title_my_followed_fans),
                        -1,
                        -1,
                        UserListType.MY_IDOLS);
            }
        });

        mWdhyItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                NaviUtils.gotoUserList(MyFriendsActivity.this,
                        SPUtils.getUid(MyFriendsActivity.this),
                        getString(R.string.title_my_friends),
                        -1,
                        -1,
                        UserListType.MY_FRIENDS);
            }
        });
    }

    private void initTitleBar(){
        setTitleText(getString(R.string.title_my_friends));
    }
}
